<?php require_once('includes/config.php'); ?>
<?php require_once($rootpath.'includes/commonfunctions.php'); ?>
<?php
//-----------------------------------------------------------------------//

function getProductByProductId($productId) {
	/*
	$query = "SELECT p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id 
			FROM `products` p, `products_description` pd 
			WHERE p.products_status = '1' AND
				p.products_id = ".$productId." AND
				pd.products_id = p.products_id";
	*/
	
	$query = "SELECT *
			FROM products 
			WHERE id = ".$productId;
			
	$resultSet = mysql_query($query);
	if(!$resultSet) { echo mysql_error(); }
	
	$row = mysql_fetch_assoc($resultSet);

	return $row;
}

$productId = $_GET['product_id'];
if(empty($productId)) {echo 'Invalid product'; exit;}
$record = getProductByProductId($productId);

//echo '<pre>';var_dump($record);exit;
//-----------------------------------------------------------------------//

$metaTitle = 'Indian Mobile Price - '.$record['title'];
$metaDescription = substr($record['description'], 0, 300);
$metaKeywords = 'mobile phone, mobile phone price, indian mobile phones, mobile phone pricing, cellphones, cheap mobile phones, low rate';
//-----------------------------------------------------------------------//
?>
<?php include($rootpath.'includes/header.php')?>
<script>
PositionX = 100;
PositionY = 100;

defaultWidth  = 500;
defaultHeight = 500;
var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
	
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
	writeln('width=300-(document.body.clientWidth-document.images[0].width);');
	writeln('height=300-(document.body.clientHeight-document.images[0].height);');
	writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
	close();		
}
}

</script>
<script type="text/javascript" src="<?=$siteurl?>javascript/boxOver.js"></script>
</head>
<body>

<div id="main_container">
	<?php include($rootpath.'includes/toppart.php')?>       
      
	<?php include($rootpath.'includes/leftpart.php')?>
   
   <div class="center_content">
   	<!--<div class="center_title_bar"><?=$record['title']?></div>-->
    
    	<div class="prod_box_big">
        	<div class="top_prod_box_big"></div>
            <div class="center_prod_box_big">            
                 
                 <div class="product_img_big">
                 <a href="javascript:popImage('<?=$siteurl?>images/external/large/<?=$record['image']?>','<?=$record['title']?>')" title="header=[Zoom] body=[&nbsp;] fade=[on]">
			<img src="<?=$siteurl?>images/external/medium/<?=$record['image']?>" alt="" title="" border="0" /></a>
                 <!--<div class="thumbs">
                 <a href="#" title="header=[Thumb1] body=[&nbsp;] fade=[on]"><img src="../images/thumb1.gif" alt="" title="" border="0" /></a>
                 <a href="#" title="header=[Thumb2] body=[&nbsp;] fade=[on]"><img src="../images/thumb1.gif" alt="" title="" border="0" /></a>
                 <a href="#" title="header=[Thumb3] body=[&nbsp;] fade=[on]"><img src="../images/thumb1.gif" alt="" title="" border="0" /></a>
                 </div>-->
                 </div>
                     <div class="details_big_box">
                         <div class="product_title_big"><h1><?=$record['title']?></h1></div>
                         <div class="specifications">
                            Availability: <span class="blue">In stock</span><br />

                            Guarantee: <span class="blue">6 months</span><br />
                            
                            Shipping: <span class="blue">Available</span><br />
                            
                            Price: <span class="price">Rs. <?=number_format($record['indian_price'], 2)?></span><br />
                         </div><br clear="all" />
                        
                         <a href="#" class="addtocart">add to cart</a>
                         <a href="#" class="compare">compare</a>
                     </div>                        
            </div>
            <div class="bottom_prod_box_big"></div>                                
        </div>
    
 
 <div class="center_title_bar">Description</div>
	<div class="prod_box_big">
		<div class="top_prod_box_big"></div>
		<div class="center_prod_box_big">
			<p><?=$record['description']?></p>
		</div>
		<div class="bottom_prod_box_big"></div>
	</div>
   
   </div><!-- end of center content -->
   
   <?php include($rootpath.'includes/rightpart.php')?>
            
   </div><!-- end of main content -->
   
   <?php include($rootpath.'includes/bottompart.php')?>               


</div>
<!-- end of main_container -->
</body>
</html>